package com.aspose.cells;

public class PaneCollection {
   private Worksheet b;
   boolean a = false;
   private byte c = 3;
   private int d;
   private short e;
   private int f;
   private int g;

   PaneCollection(Worksheet sheet) {
      this.b = sheet;
   }

   public int getFirstVisibleRowOfBottomPane() {
      return this.d;
   }

   public void setFirstVisibleRowOfBottomPane(int value) {
      this.d = value;
   }

   public int getFirstVisibleColumnOfRightPane() {
      return this.e;
   }

   public void setFirstVisibleColumnOfRightPane(int value) {
      this.e = (short)value;
   }

   public int getAcitvePaneType() {
      if (this.g == 0) {
         if (this.f == 0) {
            return 3;
         } else {
            switch(this.c) {
            case 2:
               return 0;
            default:
               return 6;
            }
         }
      } else if (this.f == 0) {
         switch(this.c) {
         case 1:
            return 5;
         default:
            return 4;
         }
      } else {
         switch(this.c) {
         case 0:
            return 2;
         case 1:
            return 8;
         case 2:
            return 1;
         default:
            return 7;
         }
      }
   }

   public void setAcitvePaneType(int value) {
      if (this.g == 0) {
         if (this.f == 0) {
            this.c = 3;
         } else {
            switch(value) {
            case 0:
               this.c = 2;
               break;
            case 6:
               this.c = 3;
            }
         }
      } else if (this.f == 0) {
         switch(value) {
         case 4:
            this.c = 3;
            break;
         case 5:
            this.c = 1;
         }
      } else {
         switch(value) {
         case 1:
            this.c = 2;
            break;
         case 2:
            this.c = 0;
         case 3:
         case 4:
         case 5:
         case 6:
         default:
            break;
         case 7:
            this.c = 3;
            break;
         case 8:
            this.c = 1;
         }
      }

   }

   byte a() {
      return this.c;
   }

   void a(byte var1) {
      this.c = var1;
   }

   void a(int var1, int var2) {
      if (this.e > var1 && (this.g > 1 || var2 >= 0)) {
         int var3 = this.b.getFirstVisibleColumn();
         if (var1 >= var3 && var1 < var3 + this.g) {
            int var4 = this.g + var2;
            if (var4 <= 0) {
               var2 = -this.g + 1;
               this.g = 1;
            } else {
               this.g = var4;
            }

            zbcj var5 = this.b.s();
            boolean var6 = false;
            this.e += (short)var2;

            for(int var7 = 0; var7 < var5.size(); ++var7) {
               zbci var8 = (zbci)var5.get(var7);

               for(int var9 = 0; var9 < var8.b().size(); ++var9) {
                  var6 = false;
                  CellArea var10 = (CellArea)var8.b().get(var9);
                  boolean[] var11 = new boolean[]{var6};
                  var10 = zayd.b(var10, var1, var2, var11);
                  var6 = var11[0];
                  if (!var6) {
                     var8.b().set(var9, var10);
                  }
               }

               if (var8.d() >= var1) {
                  var8.b(var8.d() + var2);
                  if (var8.d() < 0) {
                     var8.b(0);
                  }
               }
            }
         }

      }
   }

   void b(int var1, int var2) {
      if (this.d > var1 && (this.f > 1 || var2 >= 0)) {
         int var3 = this.b.getFirstVisibleRow();
         if (var1 >= var3 && var1 < var3 + this.f) {
            int var4 = this.f + var2;
            if (var4 <= 0) {
               var2 = -this.f + 1;
               this.f = 1;
            } else {
               this.f = var4;
            }

            this.d += var2;
            zbcj var5 = this.b.s();
            boolean var6 = false;

            for(int var7 = 0; var7 < var5.size(); ++var7) {
               zbci var8 = (zbci)var5.get(var7);

               for(int var9 = 0; var9 < var8.b().size(); ++var9) {
                  var6 = false;
                  CellArea var10 = (CellArea)var8.b().get(var9);
                  boolean[] var11 = new boolean[]{var6};
                  var10 = zayd.a(var10, var1, var2, var11);
                  var6 = var11[0];
                  if (!var6) {
                     var8.b().set(var9, var10);
                  }
               }

               if (var8.c() >= var1) {
                  var8.a(var8.c() + var2);
                  if (var8.c() < var1) {
                     var8.a(var1);
                  }
               }
            }
         }

      }
   }

   void a(PaneCollection var1) {
      this.d = var1.d;
      this.e = var1.e;
      this.f = var1.f;
      this.g = var1.g;
      this.c = var1.c;
   }

   int b() {
      return this.d;
   }

   void a(int var1) {
      this.d = var1;
   }

   int c() {
      return this.e;
   }

   void b(int var1) {
      this.e = (short)var1;
   }

   int d() {
      return this.f;
   }

   void c(int var1) {
      this.f = var1;
   }

   int e() {
      return this.g;
   }

   void d(int var1) {
      this.g = var1;
   }

   void a(String var1) {
      byte var2 = 0;
      byte var3 = 0;
      int[] var4 = new int[]{var2};
      int[] var5 = new int[]{var3};
      CellsHelper.a(var1, var4, var5);
      int var8 = var4[0];
      int var9 = var5[0];
      Cells var6;
      int var7;
      if (var8 == 0) {
         if (var9 == 0) {
            this.g = 8070;
            this.f = 4275;
            this.d = 15;
            this.e = 8;
         } else {
            this.f = 0;
            if (var9 < 8) {
               var6 = this.b.getCells();

               for(var7 = 0; var7 < var9; ++var7) {
                  this.g += var6.getColumnWidthPixel(var7);
               }

               this.g = (int)((double)((float)this.g * 72.0F * 20.0F / (float)this.b.c().L()) + 0.5D);
            }

            this.e = (short)var9;
            this.d = 0;
         }
      } else if (var9 == 0) {
         this.g = 0;
         if (var8 < 15) {
            var6 = this.b.getCells();

            for(var7 = 0; var7 < var8; ++var7) {
               this.f += (int)(var6.getRowHeight(var7) * 20.0D + 0.5D);
            }
         } else {
            this.f = 4275;
         }

         this.d = var8;
         this.e = 0;
      } else {
         if (var8 < 15) {
            var6 = this.b.getCells();

            for(var7 = 0; var7 < var8; ++var7) {
               this.f += (int)(var6.getRowHeight(var7) * 20.0D + 0.5D);
            }
         } else {
            this.f = 4275;
         }

         if (var9 >= 8) {
            this.g = 8070;
         } else {
            var6 = this.b.getCells();

            for(var7 = 0; var7 < var9; ++var7) {
               this.g += var6.getColumnWidthPixel(var7);
            }

            this.g = (int)((double)((float)this.g * 72.0F * 20.0F / (float)this.b.c().L()) + 0.5D);
         }

         this.d = var8;
         this.e = (short)var9;
      }

      this.b.setFirstVisibleRow(var8 - 15 > 0 ? var8 - 15 : 0);
      this.b.setFirstVisibleColumn(var9 - 8 > 0 ? var9 - 8 : 0);
      this.f();
   }

   void f() {
      zbcj var1 = new zbcj(this.b);
      this.b.a(var1);
      zbci var2 = null;
      if (this.d == 0) {
         var2 = new zbci(3);
         var2.a(this.b.getFirstVisibleRow(), this.b.getFirstVisibleColumn());
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
         var2 = new zbci(1);
         this.c = 1;
         var2.a(this.d, this.e);
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
      } else if (this.e == 0) {
         var2 = new zbci(3);
         var2.a(this.b.getFirstVisibleRow(), this.b.getFirstVisibleColumn());
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
         var2 = new zbci(2);
         this.c = 2;
         var2.a(this.d, this.e);
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
      } else {
         var2 = new zbci(3);
         var2.a(this.b.getFirstVisibleRow(), this.b.getFirstVisibleColumn());
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
         var2 = new zbci(2);
         var2.a(this.d, this.b.getFirstVisibleColumn());
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
         var2 = new zbci(1);
         var2.a(this.b.getFirstVisibleRow(), this.e);
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
         var2 = new zbci(0);
         this.c = 0;
         var2.a(this.d, this.e);
         com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
      }

   }

   void a(int var1, int var2, int var3, int var4) {
      this.f = var1;
      this.g = var2;
      this.d = var3;
      this.e = (short)var4;
   }

   void b(int var1, int var2, int var3, int var4) {
      this.f = var3;
      this.g = var4;
      this.d = var1;
      this.e = (short)var2;
   }

   void c(int var1, int var2, int var3, int var4) {
      if (var3 == 0) {
         var1 = 0;
      }

      if (var4 == 0) {
         var2 = 0;
      }

      if (var1 == 0 && var2 == 0) {
         throw new IllegalArgumentException();
      } else {
         this.d = var1;
         this.e = (short)var2;
         this.f = var3;
         this.g = var4;
         boolean var5 = false;
         boolean var6 = false;
         int var10;
         int var11;
         if (var1 == 0) {
            this.c = 1;
            this.f = 0;
            var10 = 0;
            if (var4 > var2) {
               this.g = var2;
               var11 = 0;
            } else {
               var11 = var2 - var4;
            }
         } else if (var2 == 0) {
            var11 = 0;
            this.c = 2;
            this.g = 0;
            if (var3 > var1) {
               this.f = var1;
               var10 = 0;
            } else {
               var10 = var1 - var3;
            }
         } else {
            this.c = 0;
            if (var4 > var2) {
               this.g = var2;
               var11 = 0;
            } else {
               var11 = var2 - var4;
            }

            if (var3 > var1) {
               this.f = var1;
               var10 = 0;
            } else {
               var10 = var1 - var3;
            }
         }

         Cells var7 = this.b.getCells();
         int var8;
         if (var10 != 0) {
            while(var10 >= 0) {
               var8 = var7.getRows().d(var10);
               if (var8 == -1) {
                  break;
               }

               Row var9 = var7.getRows().getRowByIndex(var8);
               if (!var9.isHidden()) {
                  break;
               }

               --var10;
            }
         }

         if (var11 != 0) {
            while(var11 >= 0) {
               var8 = var7.getColumns().e(var11);
               if (var8 <= -1) {
                  break;
               }

               Column var12 = var7.getColumns().getColumnByIndex(var8);
               if (!var12.isHidden()) {
                  break;
               }

               --var11;
            }

            if (var11 < 0) {
               var11 = 0;
            }
         }

         this.b.setFirstVisibleRow(var10);
         this.b.setFirstVisibleColumn(var11);
         this.f();
      }
   }
}
